<template>
  <div class="bg">
    <div content="con">
      <el-card class="box-card">
        <div ref="stuLoginRef" class="text item">
          <el-input v-model="stuNumber" placeholder="请输入学号"></el-input>
          <el-input v-model="password" placeholder="请输入密码" show-password></el-input>
          <div>
            <el-button style="width: 200px" type="primary" @click="Login">登录</el-button>
          </div>
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>

import {stuLogin} from "@/api/student-api";

export default {
  name: "StudentSign",
  data() {
    return {
      stuNumber: '',
      password: '',
    }
  },
  methods: {
    async Login() {
      try {
        const stuNum = parseInt(this.stuNumber);
        const res = await stuLogin(stuNum, this.password);
        console.log(res);
        if (res.data.code === 200) {
          await this.$router.push('/sign')
        }
      } catch (error) {
        console.log(error)
      }

    }
  }
}
</script>

<style lang="less" scoped>
.text {
  font-size: 14px;
  text-align: center;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 480px;
}

.el-input__inner {
  text-align: center;
}

.el-card {
  width: 473px;
  height: 280px;
  padding-top: 20px;
  background-color: rgba(255, 255, 255, 0.4);
  margin: 0 auto;
}

.el-input {
  width: 300px;
  margin-bottom: 40px;
}
</style>